import createHistory from 'history/createHashHistory';

const history = createHistory();

history.listen((location) => {
  let user = window.sessionStorage.getItem('user');
  if (!user && location.pathname !== '/login') {
    history.replace('/login');
  }
});

export default history;